package com.fivetiger.controller;

import com.fivetiger.dto.GoodsDto;
import com.fivetiger.entity.Goods;
import com.fivetiger.service.impl.GoodsServiceImpl;
import com.fivetiger.vo.PageBean;
import com.fivetiger.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/api/goods/")
public class GoodsController {
    @Autowired
    private GoodsServiceImpl service;
    @RequestMapping("save.do")
    @ResponseBody
    public R save(Goods goods){
        return service.save(goods);
    }

    @RequestMapping("all.do")
    @ResponseBody
    public PageBean select(){
        return service.query();
    }

    @RequestMapping("update.do")
    @ResponseBody
    public R update(GoodsDto goods){
        return service.update(goods);
    }
    @RequestMapping("updateEfficient.do")
    @ResponseBody
    public R updateEfficient(Goods goods){
        return service.updateEfficient(goods);
    }
}
